<?php

class UUID {

	const nil = '00000000-0000-0000-0000-000000000000';

	private static $_version = 4;
	private static $_y = array('8', '9', 'a', 'b');

	public static function Version($value = false) {
		if ($value === false) {
			return self::$_version;
		} else {
			self::$_version = $value;
		}
	}

	/*
	 * Generate()
	 */
	public static function Generate($version = null, $guid = null) {
		switch (self::$_version) {
			case 1:
				break;
			case 2:
				break;
			case 3:
				break;
			case 4:
				$hash = md5(uniqid(mt_rand(), true));
				return sprintf('%s-%s-4%s-%s%s-%s',
					substr($hash, 0, 8),
					substr($hash, 8, 4), 
					substr($hash, 12, 3),
					self::$_y[mt_rand(0, 3)],
					substr($hash, 15, 3),
					substr($hash, 18, 12)
				);
				break;
			case 5:
				break;
		}
	}

	private $_value = null;

	public function __construct($version = 4, $guid = true) {
		//$this->_value = self::Generate
	}

}
